package com.neuedu.common.utils;

import java.time.LocalDateTime;

import org.springframework.core.NamedThreadLocal;

public class CurrentDateTimeHolder {

    private static final ThreadLocal<LocalDateTime> currentDateTimeHolder = new NamedThreadLocal<>("Current Date Time");

    public static void setCurrentDateTime() {
        currentDateTimeHolder.set(LocalDateTime.now());
    }

    public static LocalDateTime getCurrentDateTime() {
        return currentDateTimeHolder.get();
    }

    public static void remove() {
        currentDateTimeHolder.remove();
    }

}
